/// @tags:
#include <cstdio>
#include <iostream>

using namespace std;

namespace BlueQuantum {

typedef long long LL;

int const N = 1e6 + 5, mod = 1e9 + 7;

int p_cnt;
int pri[N], mu[N];
bool vis[N];

inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}

inline void prework(int n) {
  mu[1] = 1;
  for (int i = 2; i <= n; i++) {
    if (vis[i] == false) pri[++p_cnt] = i, mu[i] = -1;
    for (int j = 1; j <= p_cnt && pri[j] * i <= n; ++j) {
      int x = pri[j] * i;
      vis[x] = true;
      if (i % pri[j] == 0) break;
      mu[x] = -mu[i];
    }
  }
}

inline LL getS(LL n, LL ans = 0) {
  for (LL l = 1, r; l <= n; l = r + 1) r = n / (n / l), ans += (n / l) * (r - l + 1);
  return ans % mod;
}

inline int main() {
  LL n, ans = 0, sqrt = 1;
  cin >> n;
  while ((LL)(sqrt + 1) * (sqrt + 1) <= n) sqrt++;
  prework(sqrt);
  for (int i = 1; i * i <= n; ++i)
    if (mu[i]) ans = add(ans, mu[i] * getS(n / i / i));
  cout << ans;
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("elegant.in", "r", stdin);
  freopen("elegant.out", "w", stdout);
#endif
#endif

  ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
